package com.xh.chat.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 添加好友前置状态 枚举
 */
@Getter
@AllArgsConstructor
public enum SearchFriendsStatusEnum {

    SUCCESS(0, "OK"),
    USER_NOT_EXIST(1, "无此用户..."),
    NOT_YOURSELF(2, "不能添加你自己..."),
    ALREADY_FRIENDS(3, "该用户已经是你的好友..."),
    DEFAULT(3, "该用户已经是你的好友...");

    private final Integer status;
    private final String msg;

    public static String getMsgByKey(Integer status) {
        return Stream.of(values())
                .filter(item -> item.getStatus().equals(status))
                .findFirst().orElse(DEFAULT).getMsg();
    }

}
